package jsu.xxy.coffee3.controller;

//import com.alibaba.fastjson.JSONArray;
//import com.alibaba.fastjson.JSONObject;
import io.swagger.v3.oas.annotations.Operation;
import jsu.xxy.coffee3.domain.Gd;
import jsu.xxy.coffee3.domain.GdNoGid;
import jsu.xxy.coffee3.mapper.GdMapper;
import jsu.xxy.coffee3.service.impl.GdServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.ArrayList;
import java.util.List;

@RestController
@CrossOrigin
@RequestMapping("/gd")

public class GdController {

    @Autowired
    GdServiceImpl gdService;
    @Autowired
    GdMapper gdMapper;
    @PostMapping("/add")
    @Operation(summary = "挂单")
    public boolean add(@RequestBody List<GdNoGid> goods_table_data){
        System.out.println("进入");
//        return true;
        return gdService.addAll(goods_table_data);

    }
    @GetMapping("/getGd")
    @Operation(summary = "取出挂单信息")
    public List<Gd> getGd(){
        return gdService.getGd();

    }

    @DeleteMapping("/deleteGd")
    @Operation(summary = "删除挂单信息")
    public int deleteGd(){
        return gdService.deleteGd();

    }


}
